\hypertarget{group__pfleury__uart}{
\section{UART Library}
\label{group__pfleury__uart}\index{UART Library@{UART Library}}
}


Interrupt UART library using the built-\/in UART with transmit and receive circular buffers.  
\subsection*{Defines}
\begin{DoxyCompactItemize}
\item 
\#define \hyperlink{group__pfleury__uart_ga367ff7b5de225ed936a63239ad4adb0b}{UART\_\-BAUD\_\-SELECT}(baudRate, xtalCpu)~((xtalCpu)/((baudRate)$\ast$16l)-\/0.5)
\begin{DoxyCompactList}\small\item\em UART Baudrate Expression. \item\end{DoxyCompactList}\item 
\#define \hyperlink{group__pfleury__uart_ga1a02d45130520cb651ab313e69039382}{UART\_\-BAUD\_\-SELECT\_\-DOUBLE\_\-SPEED}(baudRate, xtalCpu)~(((xtalCpu)/((baudRate)$\ast$8l)-\/1)$|$0x8000)
\begin{DoxyCompactList}\small\item\em UART Baudrate Expression for ATmega double speed mode. \item\end{DoxyCompactList}\item 
\#define \hyperlink{group__pfleury__uart_ga5bdd6772c246436bb14377095de79b31}{UART\_\-RX\_\-BUFFER\_\-SIZE}~64
\item 
\#define \hyperlink{group__pfleury__uart_ga05f5d709605c6317c97e4974bec3402a}{UART\_\-TX\_\-BUFFER\_\-SIZE}~64
\item 
\#define \hyperlink{group__pfleury__uart_gabcdb1041d763560cd8f8e722370dfd37}{UART\_\-FRAME\_\-ERROR}~0x0800
\item 
\#define \hyperlink{group__pfleury__uart_ga3183177e3613d8785d8cc8516931beb6}{UART\_\-OVERRUN\_\-ERROR}~0x0400
\item 
\#define \hyperlink{group__pfleury__uart_ga94758f3dad6864703b7417d3e40f11df}{UART\_\-BUFFER\_\-OVERFLOW}~0x0200
\item 
\#define \hyperlink{group__pfleury__uart_ga77ba544d423ff42d400220a05303f268}{UART\_\-NO\_\-DATA}~0x0100
\item 
\#define \hyperlink{group__pfleury__uart_ga57bacc1e506f422e7a211eea0612fa0b}{UART\_\-FORMAT\_\-8D0P1S}~0
\item 
\#define \hyperlink{group__pfleury__uart_gaca07239f804a550b871e719ce9e3dca0}{UART\_\-FORMAT\_\-8DEP1S}~1
\item 
\#define \hyperlink{group__pfleury__uart_gaea96ce420f365ef080f17bfdf6deaede}{UART\_\-FORMAT\_\-8DOP1S}~2
\item 
\#define \hyperlink{group__pfleury__uart_ga50dfb815b6650c82573c6b88ea4e8e1b}{UART\_\-FORMAT\_\-8D0P2S}~3
\item 
\#define \hyperlink{group__pfleury__uart_gaf5061893c0cfa22da9bad958270d2372}{UART\_\-FORMAT\_\-8DEP2S}~4
\item 
\#define \hyperlink{group__pfleury__uart_ga500a5b15d52540cd77e478bcec657f45}{UART\_\-FORMAT\_\-8DOP2S}~5
\item 
\#define \hyperlink{group__pfleury__uart_gae9e143569df2285379bc55f9f5595bf9}{uart\_\-puts\_\-P}(\_\-\_\-s)~uart\_\-puts\_\-p(PSTR(\_\-\_\-s))
\begin{DoxyCompactList}\small\item\em Macro to automatically put a string constant into program memory. \item\end{DoxyCompactList}\item 
\#define \hyperlink{group__pfleury__uart_gaabd7a5b0c15611ee9ecb2873cc9ee87a}{uart1\_\-puts\_\-P}(\_\-\_\-s)~uart1\_\-puts\_\-p(PSTR(\_\-\_\-s))
\begin{DoxyCompactList}\small\item\em Macro to automatically put a string constant into program memory. \item\end{DoxyCompactList}\end{DoxyCompactItemize}
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
void \hyperlink{group__pfleury__uart_ga5701b005bc0cffffb39cdd906116ebe4}{uart\_\-init} (unsigned int baudrate, unsigned char format)
\begin{DoxyCompactList}\small\item\em Initialize UART and set baudrate. \item\end{DoxyCompactList}\item 
unsigned int \hyperlink{group__pfleury__uart_gaefaab30a8338ec46a6be35b99b1b4f09}{uart\_\-getc} (void)
\begin{DoxyCompactList}\small\item\em Get received byte from ringbuffer. \item\end{DoxyCompactList}\item 
void \hyperlink{group__pfleury__uart_gad975221bc08b901e4c7ad69f9c9a97e2}{uart\_\-putc} (unsigned char data)
\begin{DoxyCompactList}\small\item\em Put byte to ringbuffer for transmitting via UART. \item\end{DoxyCompactList}\item 
void \hyperlink{group__pfleury__uart_ga5bb9ccbe5b0438412915dd339f1eb68c}{uart\_\-puti} (int data)
\item 
void \hyperlink{group__pfleury__uart_gae52facc0a56086a365bb0018160d8d71}{uart\_\-puts} (const char $\ast$s)
\begin{DoxyCompactList}\small\item\em Put string to ringbuffer for transmitting via UART. \item\end{DoxyCompactList}\item 
void \hyperlink{group__pfleury__uart_gaf3ba982ae2eee7a8db1f89240a16b4d1}{uart\_\-puts\_\-len} (const unsigned char $\ast$s, unsigned int len)
\begin{DoxyCompactList}\small\item\em Put string to ringbuffer for transmitting via UART. Number of sended characters are given. \item\end{DoxyCompactList}\item 
void \hyperlink{group__pfleury__uart_ga6d78b6744db6232f52b4616402036c2f}{uart\_\-puts\_\-p} (const char $\ast$s)
\begin{DoxyCompactList}\small\item\em Put string from program memory to ringbuffer for transmitting via UART. \item\end{DoxyCompactList}\item 
char \hyperlink{group__pfleury__uart_ga7da3f9ebba28d4d1b59581a57d6023f4}{uart\_\-gets} (char $\ast$s)
\item 
void \hyperlink{group__pfleury__uart_ga3380272cdfea0cf440cb299c2c84a8db}{uart1\_\-init} (unsigned int baudrate, unsigned char format)
\begin{DoxyCompactList}\small\item\em Initialize USART1 (only available on selected ATmegas). \item\end{DoxyCompactList}\item 
unsigned int \hyperlink{group__pfleury__uart_gaeb1405c641e5bc9b7224018f5e8d90de}{uart1\_\-getc} (void)
\begin{DoxyCompactList}\small\item\em Get received byte of USART1 from ringbuffer. (only available on selected ATmega). \item\end{DoxyCompactList}\item 
void \hyperlink{group__pfleury__uart_gab465f689d197fadfbacc374fc9411154}{uart1\_\-putc} (unsigned char data)
\begin{DoxyCompactList}\small\item\em Put byte to ringbuffer for transmitting via USART1 (only available on selected ATmega). \item\end{DoxyCompactList}\item 
void \hyperlink{group__pfleury__uart_ga5568f8f3913b218fd4d0346af78831b2}{uart1\_\-puts} (const char $\ast$s)
\begin{DoxyCompactList}\small\item\em Put string to ringbuffer for transmitting via USART1 (only available on selected ATmega). \item\end{DoxyCompactList}\item 
void \hyperlink{group__pfleury__uart_ga1e8074d0a2d5922601c5db2f9777ba79}{uart1\_\-puts\_\-p} (const char $\ast$s)
\begin{DoxyCompactList}\small\item\em Put string from program memory to ringbuffer for transmitting via USART1 (only available on selected ATmega). \item\end{DoxyCompactList}\end{DoxyCompactItemize}


\subsection{Detailed Description}

\begin{DoxyCode}
 #include <uart.h> 
\end{DoxyCode}


This library can be used to transmit and receive data through the built in UART.

An interrupt is generated when the UART has finished transmitting or receiving a byte. The interrupt handling routines use circular buffers for buffering received and transmitted data.

The UART\_\-RX\_\-BUFFER\_\-SIZE and UART\_\-TX\_\-BUFFER\_\-SIZE constants define the size of the circular buffers in bytes. Note that these constants must be a power of 2. You may need to adapt this constants to your target and your application by adding CDEFS += -\/DUART\_\-RX\_\-BUFFER\_\-SIZE=nn -\/DUART\_\-RX\_\-BUFFER\_\-SIZE=nn to your Makefile.

\begin{DoxyNote}{Note}
Based on Atmel Application Note AVR306 
\end{DoxyNote}
\begin{DoxyAuthor}{Author}
Peter Fleury \href{mailto:pfleury@gmx.ch}{\tt pfleury@gmx.ch} \href{http://jump.to/fleury}{\tt http://jump.to/fleury} 
\end{DoxyAuthor}


\subsection{Define Documentation}
\hypertarget{group__pfleury__uart_gaabd7a5b0c15611ee9ecb2873cc9ee87a}{
\index{pfleury\_\-uart@{pfleury\_\-uart}!uart1\_\-puts\_\-P@{uart1\_\-puts\_\-P}}
\index{uart1\_\-puts\_\-P@{uart1\_\-puts\_\-P}!pfleury_uart@{pfleury\_\-uart}}
\subsubsection[{uart1\_\-puts\_\-P}]{\setlength{\rightskip}{0pt plus 5cm}\#define uart1\_\-puts\_\-P(\_\-\_\-s)~uart1\_\-puts\_\-p(PSTR(\_\-\_\-s))}}
\label{group__pfleury__uart_gaabd7a5b0c15611ee9ecb2873cc9ee87a}
\hypertarget{group__pfleury__uart_ga367ff7b5de225ed936a63239ad4adb0b}{
\index{pfleury\_\-uart@{pfleury\_\-uart}!UART\_\-BAUD\_\-SELECT@{UART\_\-BAUD\_\-SELECT}}
\index{UART\_\-BAUD\_\-SELECT@{UART\_\-BAUD\_\-SELECT}!pfleury_uart@{pfleury\_\-uart}}
\subsubsection[{UART\_\-BAUD\_\-SELECT}]{\setlength{\rightskip}{0pt plus 5cm}\#define UART\_\-BAUD\_\-SELECT(baudRate, \/  xtalCpu)~((xtalCpu)/((baudRate)$\ast$16l)-\/0.5)}}
\label{group__pfleury__uart_ga367ff7b5de225ed936a63239ad4adb0b}

\begin{DoxyParams}{Parameters}
\item[{\em xtalcpu}]system clock in Mhz, e.g. 4000000L for 4Mhz \item[{\em baudrate}]baudrate in bps, e.g. 1200, 2400, 9600 \end{DoxyParams}
\hypertarget{group__pfleury__uart_ga1a02d45130520cb651ab313e69039382}{
\index{pfleury\_\-uart@{pfleury\_\-uart}!UART\_\-BAUD\_\-SELECT\_\-DOUBLE\_\-SPEED@{UART\_\-BAUD\_\-SELECT\_\-DOUBLE\_\-SPEED}}
\index{UART\_\-BAUD\_\-SELECT\_\-DOUBLE\_\-SPEED@{UART\_\-BAUD\_\-SELECT\_\-DOUBLE\_\-SPEED}!pfleury_uart@{pfleury\_\-uart}}
\subsubsection[{UART\_\-BAUD\_\-SELECT\_\-DOUBLE\_\-SPEED}]{\setlength{\rightskip}{0pt plus 5cm}\#define UART\_\-BAUD\_\-SELECT\_\-DOUBLE\_\-SPEED(baudRate, \/  xtalCpu)~(((xtalCpu)/((baudRate)$\ast$8l)-\/1)$|$0x8000)}}
\label{group__pfleury__uart_ga1a02d45130520cb651ab313e69039382}

\begin{DoxyParams}{Parameters}
\item[{\em xtalcpu}]system clock in Mhz, e.g. 4000000L for 4Mhz \item[{\em baudrate}]baudrate in bps, e.g. 1200, 2400, 9600 \end{DoxyParams}
\hypertarget{group__pfleury__uart_ga94758f3dad6864703b7417d3e40f11df}{
\index{pfleury\_\-uart@{pfleury\_\-uart}!UART\_\-BUFFER\_\-OVERFLOW@{UART\_\-BUFFER\_\-OVERFLOW}}
\index{UART\_\-BUFFER\_\-OVERFLOW@{UART\_\-BUFFER\_\-OVERFLOW}!pfleury_uart@{pfleury\_\-uart}}
\subsubsection[{UART\_\-BUFFER\_\-OVERFLOW}]{\setlength{\rightskip}{0pt plus 5cm}\#define UART\_\-BUFFER\_\-OVERFLOW~0x0200}}
\label{group__pfleury__uart_ga94758f3dad6864703b7417d3e40f11df}
\hypertarget{group__pfleury__uart_ga57bacc1e506f422e7a211eea0612fa0b}{
\index{pfleury\_\-uart@{pfleury\_\-uart}!UART\_\-FORMAT\_\-8D0P1S@{UART\_\-FORMAT\_\-8D0P1S}}
\index{UART\_\-FORMAT\_\-8D0P1S@{UART\_\-FORMAT\_\-8D0P1S}!pfleury_uart@{pfleury\_\-uart}}
\subsubsection[{UART\_\-FORMAT\_\-8D0P1S}]{\setlength{\rightskip}{0pt plus 5cm}\#define UART\_\-FORMAT\_\-8D0P1S~0}}
\label{group__pfleury__uart_ga57bacc1e506f422e7a211eea0612fa0b}
\hypertarget{group__pfleury__uart_ga50dfb815b6650c82573c6b88ea4e8e1b}{
\index{pfleury\_\-uart@{pfleury\_\-uart}!UART\_\-FORMAT\_\-8D0P2S@{UART\_\-FORMAT\_\-8D0P2S}}
\index{UART\_\-FORMAT\_\-8D0P2S@{UART\_\-FORMAT\_\-8D0P2S}!pfleury_uart@{pfleury\_\-uart}}
\subsubsection[{UART\_\-FORMAT\_\-8D0P2S}]{\setlength{\rightskip}{0pt plus 5cm}\#define UART\_\-FORMAT\_\-8D0P2S~3}}
\label{group__pfleury__uart_ga50dfb815b6650c82573c6b88ea4e8e1b}
\hypertarget{group__pfleury__uart_gaca07239f804a550b871e719ce9e3dca0}{
\index{pfleury\_\-uart@{pfleury\_\-uart}!UART\_\-FORMAT\_\-8DEP1S@{UART\_\-FORMAT\_\-8DEP1S}}
\index{UART\_\-FORMAT\_\-8DEP1S@{UART\_\-FORMAT\_\-8DEP1S}!pfleury_uart@{pfleury\_\-uart}}
\subsubsection[{UART\_\-FORMAT\_\-8DEP1S}]{\setlength{\rightskip}{0pt plus 5cm}\#define UART\_\-FORMAT\_\-8DEP1S~1}}
\label{group__pfleury__uart_gaca07239f804a550b871e719ce9e3dca0}
\hypertarget{group__pfleury__uart_gaf5061893c0cfa22da9bad958270d2372}{
\index{pfleury\_\-uart@{pfleury\_\-uart}!UART\_\-FORMAT\_\-8DEP2S@{UART\_\-FORMAT\_\-8DEP2S}}
\index{UART\_\-FORMAT\_\-8DEP2S@{UART\_\-FORMAT\_\-8DEP2S}!pfleury_uart@{pfleury\_\-uart}}
\subsubsection[{UART\_\-FORMAT\_\-8DEP2S}]{\setlength{\rightskip}{0pt plus 5cm}\#define UART\_\-FORMAT\_\-8DEP2S~4}}
\label{group__pfleury__uart_gaf5061893c0cfa22da9bad958270d2372}
\hypertarget{group__pfleury__uart_gaea96ce420f365ef080f17bfdf6deaede}{
\index{pfleury\_\-uart@{pfleury\_\-uart}!UART\_\-FORMAT\_\-8DOP1S@{UART\_\-FORMAT\_\-8DOP1S}}
\index{UART\_\-FORMAT\_\-8DOP1S@{UART\_\-FORMAT\_\-8DOP1S}!pfleury_uart@{pfleury\_\-uart}}
\subsubsection[{UART\_\-FORMAT\_\-8DOP1S}]{\setlength{\rightskip}{0pt plus 5cm}\#define UART\_\-FORMAT\_\-8DOP1S~2}}
\label{group__pfleury__uart_gaea96ce420f365ef080f17bfdf6deaede}
\hypertarget{group__pfleury__uart_ga500a5b15d52540cd77e478bcec657f45}{
\index{pfleury\_\-uart@{pfleury\_\-uart}!UART\_\-FORMAT\_\-8DOP2S@{UART\_\-FORMAT\_\-8DOP2S}}
\index{UART\_\-FORMAT\_\-8DOP2S@{UART\_\-FORMAT\_\-8DOP2S}!pfleury_uart@{pfleury\_\-uart}}
\subsubsection[{UART\_\-FORMAT\_\-8DOP2S}]{\setlength{\rightskip}{0pt plus 5cm}\#define UART\_\-FORMAT\_\-8DOP2S~5}}
\label{group__pfleury__uart_ga500a5b15d52540cd77e478bcec657f45}
\hypertarget{group__pfleury__uart_gabcdb1041d763560cd8f8e722370dfd37}{
\index{pfleury\_\-uart@{pfleury\_\-uart}!UART\_\-FRAME\_\-ERROR@{UART\_\-FRAME\_\-ERROR}}
\index{UART\_\-FRAME\_\-ERROR@{UART\_\-FRAME\_\-ERROR}!pfleury_uart@{pfleury\_\-uart}}
\subsubsection[{UART\_\-FRAME\_\-ERROR}]{\setlength{\rightskip}{0pt plus 5cm}\#define UART\_\-FRAME\_\-ERROR~0x0800}}
\label{group__pfleury__uart_gabcdb1041d763560cd8f8e722370dfd37}
\hypertarget{group__pfleury__uart_ga77ba544d423ff42d400220a05303f268}{
\index{pfleury\_\-uart@{pfleury\_\-uart}!UART\_\-NO\_\-DATA@{UART\_\-NO\_\-DATA}}
\index{UART\_\-NO\_\-DATA@{UART\_\-NO\_\-DATA}!pfleury_uart@{pfleury\_\-uart}}
\subsubsection[{UART\_\-NO\_\-DATA}]{\setlength{\rightskip}{0pt plus 5cm}\#define UART\_\-NO\_\-DATA~0x0100}}
\label{group__pfleury__uart_ga77ba544d423ff42d400220a05303f268}
\hypertarget{group__pfleury__uart_ga3183177e3613d8785d8cc8516931beb6}{
\index{pfleury\_\-uart@{pfleury\_\-uart}!UART\_\-OVERRUN\_\-ERROR@{UART\_\-OVERRUN\_\-ERROR}}
\index{UART\_\-OVERRUN\_\-ERROR@{UART\_\-OVERRUN\_\-ERROR}!pfleury_uart@{pfleury\_\-uart}}
\subsubsection[{UART\_\-OVERRUN\_\-ERROR}]{\setlength{\rightskip}{0pt plus 5cm}\#define UART\_\-OVERRUN\_\-ERROR~0x0400}}
\label{group__pfleury__uart_ga3183177e3613d8785d8cc8516931beb6}
\hypertarget{group__pfleury__uart_gae9e143569df2285379bc55f9f5595bf9}{
\index{pfleury\_\-uart@{pfleury\_\-uart}!uart\_\-puts\_\-P@{uart\_\-puts\_\-P}}
\index{uart\_\-puts\_\-P@{uart\_\-puts\_\-P}!pfleury_uart@{pfleury\_\-uart}}
\subsubsection[{uart\_\-puts\_\-P}]{\setlength{\rightskip}{0pt plus 5cm}\#define uart\_\-puts\_\-P(\_\-\_\-s)~uart\_\-puts\_\-p(PSTR(\_\-\_\-s))}}
\label{group__pfleury__uart_gae9e143569df2285379bc55f9f5595bf9}
\hypertarget{group__pfleury__uart_ga5bdd6772c246436bb14377095de79b31}{
\index{pfleury\_\-uart@{pfleury\_\-uart}!UART\_\-RX\_\-BUFFER\_\-SIZE@{UART\_\-RX\_\-BUFFER\_\-SIZE}}
\index{UART\_\-RX\_\-BUFFER\_\-SIZE@{UART\_\-RX\_\-BUFFER\_\-SIZE}!pfleury_uart@{pfleury\_\-uart}}
\subsubsection[{UART\_\-RX\_\-BUFFER\_\-SIZE}]{\setlength{\rightskip}{0pt plus 5cm}\#define UART\_\-RX\_\-BUFFER\_\-SIZE~64}}
\label{group__pfleury__uart_ga5bdd6772c246436bb14377095de79b31}
Size of the circular receive buffer, must be power of 2 \hypertarget{group__pfleury__uart_ga05f5d709605c6317c97e4974bec3402a}{
\index{pfleury\_\-uart@{pfleury\_\-uart}!UART\_\-TX\_\-BUFFER\_\-SIZE@{UART\_\-TX\_\-BUFFER\_\-SIZE}}
\index{UART\_\-TX\_\-BUFFER\_\-SIZE@{UART\_\-TX\_\-BUFFER\_\-SIZE}!pfleury_uart@{pfleury\_\-uart}}
\subsubsection[{UART\_\-TX\_\-BUFFER\_\-SIZE}]{\setlength{\rightskip}{0pt plus 5cm}\#define UART\_\-TX\_\-BUFFER\_\-SIZE~64}}
\label{group__pfleury__uart_ga05f5d709605c6317c97e4974bec3402a}
Size of the circular transmit buffer, must be power of 2 

\subsection{Function Documentation}
\hypertarget{group__pfleury__uart_gaeb1405c641e5bc9b7224018f5e8d90de}{
\index{pfleury\_\-uart@{pfleury\_\-uart}!uart1\_\-getc@{uart1\_\-getc}}
\index{uart1\_\-getc@{uart1\_\-getc}!pfleury_uart@{pfleury\_\-uart}}
\subsubsection[{uart1\_\-getc}]{\setlength{\rightskip}{0pt plus 5cm}unsigned int uart1\_\-getc (void)}}
\label{group__pfleury__uart_gaeb1405c641e5bc9b7224018f5e8d90de}
\begin{DoxySeeAlso}{See also}
\hyperlink{group__pfleury__uart_gaefaab30a8338ec46a6be35b99b1b4f09}{uart\_\-getc} 
\end{DoxySeeAlso}
\hypertarget{group__pfleury__uart_ga3380272cdfea0cf440cb299c2c84a8db}{
\index{pfleury\_\-uart@{pfleury\_\-uart}!uart1\_\-init@{uart1\_\-init}}
\index{uart1\_\-init@{uart1\_\-init}!pfleury_uart@{pfleury\_\-uart}}
\subsubsection[{uart1\_\-init}]{\setlength{\rightskip}{0pt plus 5cm}void uart1\_\-init (unsigned int {\em baudrate}, \/  unsigned char {\em format})}}
\label{group__pfleury__uart_ga3380272cdfea0cf440cb299c2c84a8db}
\begin{DoxySeeAlso}{See also}
\hyperlink{group__pfleury__uart_ga5701b005bc0cffffb39cdd906116ebe4}{uart\_\-init} 
\end{DoxySeeAlso}
\hypertarget{group__pfleury__uart_gab465f689d197fadfbacc374fc9411154}{
\index{pfleury\_\-uart@{pfleury\_\-uart}!uart1\_\-putc@{uart1\_\-putc}}
\index{uart1\_\-putc@{uart1\_\-putc}!pfleury_uart@{pfleury\_\-uart}}
\subsubsection[{uart1\_\-putc}]{\setlength{\rightskip}{0pt plus 5cm}void uart1\_\-putc (unsigned char {\em data})}}
\label{group__pfleury__uart_gab465f689d197fadfbacc374fc9411154}
\begin{DoxySeeAlso}{See also}
\hyperlink{group__pfleury__uart_gad975221bc08b901e4c7ad69f9c9a97e2}{uart\_\-putc} 
\end{DoxySeeAlso}
\hypertarget{group__pfleury__uart_ga5568f8f3913b218fd4d0346af78831b2}{
\index{pfleury\_\-uart@{pfleury\_\-uart}!uart1\_\-puts@{uart1\_\-puts}}
\index{uart1\_\-puts@{uart1\_\-puts}!pfleury_uart@{pfleury\_\-uart}}
\subsubsection[{uart1\_\-puts}]{\setlength{\rightskip}{0pt plus 5cm}void uart1\_\-puts (const char $\ast$ {\em s})}}
\label{group__pfleury__uart_ga5568f8f3913b218fd4d0346af78831b2}
\begin{DoxySeeAlso}{See also}
\hyperlink{group__pfleury__uart_gae52facc0a56086a365bb0018160d8d71}{uart\_\-puts} 
\end{DoxySeeAlso}
\hypertarget{group__pfleury__uart_ga1e8074d0a2d5922601c5db2f9777ba79}{
\index{pfleury\_\-uart@{pfleury\_\-uart}!uart1\_\-puts\_\-p@{uart1\_\-puts\_\-p}}
\index{uart1\_\-puts\_\-p@{uart1\_\-puts\_\-p}!pfleury_uart@{pfleury\_\-uart}}
\subsubsection[{uart1\_\-puts\_\-p}]{\setlength{\rightskip}{0pt plus 5cm}void uart1\_\-puts\_\-p (const char $\ast$ {\em s})}}
\label{group__pfleury__uart_ga1e8074d0a2d5922601c5db2f9777ba79}
\begin{DoxySeeAlso}{See also}
\hyperlink{group__pfleury__uart_ga6d78b6744db6232f52b4616402036c2f}{uart\_\-puts\_\-p} 
\end{DoxySeeAlso}
\hypertarget{group__pfleury__uart_gaefaab30a8338ec46a6be35b99b1b4f09}{
\index{pfleury\_\-uart@{pfleury\_\-uart}!uart\_\-getc@{uart\_\-getc}}
\index{uart\_\-getc@{uart\_\-getc}!pfleury_uart@{pfleury\_\-uart}}
\subsubsection[{uart\_\-getc}]{\setlength{\rightskip}{0pt plus 5cm}unsigned int uart\_\-getc (void)}}
\label{group__pfleury__uart_gaefaab30a8338ec46a6be35b99b1b4f09}
Returns in the lower byte the received character and in the higher byte the last receive error. UART\_\-NO\_\-DATA is returned when no data is available.


\begin{DoxyParams}{Parameters}
\item[{\em void}]\end{DoxyParams}
\begin{DoxyReturn}{Returns}
lower byte: received byte from ringbuffer 

higher byte: last receive status
\begin{DoxyItemize}
\item {\bfseries 0} successfully received data from UART
\item {\bfseries UART\_\-NO\_\-DATA} \par
no receive data available
\item {\bfseries UART\_\-BUFFER\_\-OVERFLOW} \par
Receive ringbuffer overflow. We are not reading the receive buffer fast enough, one or more received character have been dropped
\item {\bfseries UART\_\-OVERRUN\_\-ERROR} \par
Overrun condition by UART. A character already present in the UART UDR register was not read by the interrupt handler before the next character arrived, one or more received characters have been dropped.
\item {\bfseries UART\_\-FRAME\_\-ERROR} \par
Framing Error by UART 
\end{DoxyItemize}
\end{DoxyReturn}
\hypertarget{group__pfleury__uart_ga7da3f9ebba28d4d1b59581a57d6023f4}{
\index{pfleury\_\-uart@{pfleury\_\-uart}!uart\_\-gets@{uart\_\-gets}}
\index{uart\_\-gets@{uart\_\-gets}!pfleury_uart@{pfleury\_\-uart}}
\subsubsection[{uart\_\-gets}]{\setlength{\rightskip}{0pt plus 5cm}char uart\_\-gets (char $\ast$ {\em s})}}
\label{group__pfleury__uart_ga7da3f9ebba28d4d1b59581a57d6023f4}
\hypertarget{group__pfleury__uart_ga5701b005bc0cffffb39cdd906116ebe4}{
\index{pfleury\_\-uart@{pfleury\_\-uart}!uart\_\-init@{uart\_\-init}}
\index{uart\_\-init@{uart\_\-init}!pfleury_uart@{pfleury\_\-uart}}
\subsubsection[{uart\_\-init}]{\setlength{\rightskip}{0pt plus 5cm}void uart\_\-init (unsigned int {\em baudrate}, \/  unsigned char {\em format})}}
\label{group__pfleury__uart_ga5701b005bc0cffffb39cdd906116ebe4}

\begin{DoxyParams}{Parameters}
\item[{\em baudrate}]Specify baudrate using macro \hyperlink{group__pfleury__uart_ga367ff7b5de225ed936a63239ad4adb0b}{UART\_\-BAUD\_\-SELECT()} \end{DoxyParams}
\begin{DoxyReturn}{Returns}
none 
\end{DoxyReturn}
\hypertarget{group__pfleury__uart_gad975221bc08b901e4c7ad69f9c9a97e2}{
\index{pfleury\_\-uart@{pfleury\_\-uart}!uart\_\-putc@{uart\_\-putc}}
\index{uart\_\-putc@{uart\_\-putc}!pfleury_uart@{pfleury\_\-uart}}
\subsubsection[{uart\_\-putc}]{\setlength{\rightskip}{0pt plus 5cm}void uart\_\-putc (unsigned char {\em data})}}
\label{group__pfleury__uart_gad975221bc08b901e4c7ad69f9c9a97e2}

\begin{DoxyParams}{Parameters}
\item[{\em data}]byte to be transmitted \end{DoxyParams}
\begin{DoxyReturn}{Returns}
none 
\end{DoxyReturn}
\hypertarget{group__pfleury__uart_ga5bb9ccbe5b0438412915dd339f1eb68c}{
\index{pfleury\_\-uart@{pfleury\_\-uart}!uart\_\-puti@{uart\_\-puti}}
\index{uart\_\-puti@{uart\_\-puti}!pfleury_uart@{pfleury\_\-uart}}
\subsubsection[{uart\_\-puti}]{\setlength{\rightskip}{0pt plus 5cm}void uart\_\-puti (int {\em data})}}
\label{group__pfleury__uart_ga5bb9ccbe5b0438412915dd339f1eb68c}
\hypertarget{group__pfleury__uart_gae52facc0a56086a365bb0018160d8d71}{
\index{pfleury\_\-uart@{pfleury\_\-uart}!uart\_\-puts@{uart\_\-puts}}
\index{uart\_\-puts@{uart\_\-puts}!pfleury_uart@{pfleury\_\-uart}}
\subsubsection[{uart\_\-puts}]{\setlength{\rightskip}{0pt plus 5cm}void uart\_\-puts (const char $\ast$ {\em s})}}
\label{group__pfleury__uart_gae52facc0a56086a365bb0018160d8d71}
The string is buffered by the uart library in a circular buffer and one character at a time is transmitted to the UART using interrupts. Blocks if it can not write the whole string into the circular buffer.


\begin{DoxyParams}{Parameters}
\item[{\em s}]string to be transmitted \end{DoxyParams}
\begin{DoxyReturn}{Returns}
none 
\end{DoxyReturn}
\hypertarget{group__pfleury__uart_gaf3ba982ae2eee7a8db1f89240a16b4d1}{
\index{pfleury\_\-uart@{pfleury\_\-uart}!uart\_\-puts\_\-len@{uart\_\-puts\_\-len}}
\index{uart\_\-puts\_\-len@{uart\_\-puts\_\-len}!pfleury_uart@{pfleury\_\-uart}}
\subsubsection[{uart\_\-puts\_\-len}]{\setlength{\rightskip}{0pt plus 5cm}void uart\_\-puts\_\-len (const unsigned char $\ast$ {\em s}, \/  unsigned int {\em len})}}
\label{group__pfleury__uart_gaf3ba982ae2eee7a8db1f89240a16b4d1}
The specified count of character are buffered by the uart library in a circular buffer and one character at a time is transmitted to the UART using interrupts. Blocks if it can not write the whole string into the circular buffer.


\begin{DoxyParams}{Parameters}
\item[{\em s}]string to be transmitted \item[{\em len}]number of bytes to be transmitted \end{DoxyParams}
\begin{DoxyReturn}{Returns}
none 
\end{DoxyReturn}
\hypertarget{group__pfleury__uart_ga6d78b6744db6232f52b4616402036c2f}{
\index{pfleury\_\-uart@{pfleury\_\-uart}!uart\_\-puts\_\-p@{uart\_\-puts\_\-p}}
\index{uart\_\-puts\_\-p@{uart\_\-puts\_\-p}!pfleury_uart@{pfleury\_\-uart}}
\subsubsection[{uart\_\-puts\_\-p}]{\setlength{\rightskip}{0pt plus 5cm}void uart\_\-puts\_\-p (const char $\ast$ {\em s})}}
\label{group__pfleury__uart_ga6d78b6744db6232f52b4616402036c2f}
The string is buffered by the uart library in a circular buffer and one character at a time is transmitted to the UART using interrupts. Blocks if it can not write the whole string into the circular buffer.


\begin{DoxyParams}{Parameters}
\item[{\em s}]program memory string to be transmitted \end{DoxyParams}
\begin{DoxyReturn}{Returns}
none 
\end{DoxyReturn}
\begin{DoxySeeAlso}{See also}
\hyperlink{group__pfleury__uart_gae9e143569df2285379bc55f9f5595bf9}{uart\_\-puts\_\-P} 
\end{DoxySeeAlso}
